<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>我的咨询</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
	<c:set var="ctx" value="${pageContext.request.contextPath}" />
    <link rel="stylesheet" href="${ctx}/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="${ctx}/assets/css/style.css?v=2.3">
    <link rel="stylesheet" href="${ctx}/assets/css/index.css?v=2.3">
    <script src="${ctx}/assets/js/myAlert.js"></script>
</head>
<body class="bg-gray">
<header data-am-widget="header" class="am-header am-header-default am-header-fixed am-border-bottom">
    <div class="am-header-left am-header-nav">
        <a onclick="history.go(-1)"> <i class="icon_8"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        我的咨询
    </h1>

</header>
<section class="am-padding-bottom-sm" id="amz-main" data-tag="css-nav">

    <!--切换tab-->
    <div data-am-widget="tabs"
         class="am-tabs am-tabs-d2 font-14 bg-white am-margin-top-sm pinglun-tabs am-border-bottom">
        <ul class="am-tabs-nav am-cf">
            <li class="am-active bg-white  ">
                <div class="width-100 border-right margin-top-6 height-30" id="quanbu"><a>全部</a></div>
            </li>
            <li class="bg-white">
                <div class="width-100 border-right margin-top-6 height-30" id="daiwangcheng"><a>待完成</a></div>
            </li>
            <li class="bg-white">
                <div class="width-100 border-right margin-top-6 height-30" id="daipingjia"><a>待评价</a></div>
            </li>
            <li class="bg-white">
                <div class="width-100  margin-top-6 height-30" id="yiwangcheng"><a>已完成</a></div>
            </li>
        </ul>

    </div>

    <!--列表-->
    <div class="margin-top-42 order_list">
    </div>
    <!--隐藏音频-->
    <div class="am-hide">
        <audio src=""  id="audio">亲 您的浏览器不支持html5的audio标签</audio>
    </div>

</section>

<footer data-am-widget="navbar" class="am-navbar am-cf am-navbar-default " id="">
    <ul class="am-navbar-nav am-cf am-avg-sm-4">

        <li>
            <a href="myzixun.jsp" class="selected">
                <img src="${ctx}/assets/images/icon/index/icon_zixun_on.png"
                     alt="我的咨询"/>
                <span class="am-navbar-label">我的咨询</span>
            </a>
        </li>

        <li>
            <a href="mypeixun.jsp" class="">
                <img src="${ctx}/assets/images/icon/index/icon_peixun.png"
                     alt="我的培训"/>
                <span class="am-navbar-label">我的培训</span>
            </a>
        </li>
        <li>
            <a href="myCounse.jsp" class="">
                <img src="${ctx}/assets/images/icon/index/icon_user.png"
                     alt="我的"/>
                <span class="am-navbar-label">我的</span>
            </a>
        </li>
    </ul>
</footer>


<div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">理由</div>
        <div class="am-modal-bd">
            <textarea rows="3" class="mark_content am-modal-prompt-input" id="jueContent" placeholder="请填写拒绝原因，拒绝后将自动退款"></textarea>
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn" data-am-modal-cancel>取消</span>
            <span class="am-modal-btn" data-am-modal-confirm>确认</span>
        </div>
    </div>
</div>

<div class="am-modal am-modal-prompt" tabindex="-1" id="my-jiesuan">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">结算</div>
        <div class="am-modal-bd">
            <textarea rows="3" class="mark_content am-modal-prompt-input"  id="jiesuanContent" placeholder="填写咨询回复情况"></textarea>
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn" data-am-modal-cancel>取消</span>
            <span class="am-modal-btn" data-am-modal-confirm>确认</span>
        </div>
    </div>
</div>

<script src="${ctx}/assets/js/jquery.min.js"></script>
<script src="${ctx}/assets/js/amazeui.min.js"></script>


<script>
	 $("#daipingjia").on("click", function () {
         var counselorList=$.ajax({url:"${ctx}/getMyCounselorOrder?orderStatus=daipingjia",async:false});
        var orderJson=JSON.parse(counselorList.responseText);
        
        if(orderJson.resultCode=="0"){
        	$(".order_list").html("");
        	for(var i=0;i<orderJson.orderList.length;i++){
        	if(orderJson.orderList[i].orderType=="1"){
        	var html="";
        	var userList=$.ajax({url:"${ctx}/getUserData?userId="+orderJson.orderList[i].userId,async:false});
       	    var userJson=JSON.parse(userList.responseText);
        	
        	html+="<div class='order_item bg-white border-bottom am-margin-bottom-sm am-padding-top-sm'>";
            html+="<div onclick='window.location.href=\"${ctx}/gotoOrderDesc?orderId="+orderJson.orderList[i].id+"\"'>";
            html+="    <div class=' bg-gray am-margin-left-sm am-margin-right-sm '>";
            html+="        <div class='am-g   am-padding-top-sm am-padding-bottom-xs border-1'>";
            html+="            <div class='am-u-sm-3 am-list-thumb am-padding-left-sm'>";
            html+="                <a class=''>";
            html+="                    <img class='img-65' src='"+userJson.wxUser.headimgurl+"'/>";
            html+="                </a>";
            html+="                <i class='icon_12'></i>";
            html+="            </div>";
            html+="            <div class=' am-u-sm-9 am-list-main'>";
            html+="                <div class='am-list-item-hd font-color-main'>";
                                html+=""+userJson.wxUser.nickname;
            html+="                </div>";
            html+="                <div class='font-12  font-color-11'>";
            html+="                    "+userJson.wxUser.telephone;
            html+="                </div>";
            html+="            </div>";
            html+="        </div>";
            html+="    </div>";
            html+="    <div class='am-padding-left-lg am-padding-right-sm am-padding-bottom-sm'>";
            html+="        <div class='box font-color-13 am-margin-bottom-sm am-margin-top-sm'>";
            html+="            <div class='width-35px'>";
            html+="                <div class='icon_04_1'></div>";
            html+="            </div>";
            html+="            <div class='box-1 '>";
            if(orderJson.orderList[i].counseType=="1"){
            	html+="咨询方式：电话咨询";
            }else if(orderJson.orderList[i].counseType=="2"){
            	html+="咨询方式：面对面咨询";
            }else{
            	html+="咨询方式：视频咨询";
            }
            html+="           </div>";
            html+="        </div>";
            html+="        <div class='box font-color-13 am-margin-bottom-sm'>";
            html+="            <div class='width-35px'>";
            html+="                <div class='icon_68_2'></div>";
            html+="            </div>";
            html+="            <div class='box-1 '>";
                            html+="预约时间："+orderJson.orderList[i].bookTimeStr;
            html+="            </div>";
            html+="        </div>";
            html+="        <div class='box font-color-13 am-margin-bottom-sm'>";
        html+="                <div class='width-35px'>";
        html+="                    <div class='icon_03_1'></div>";
        html+="                </div>";
        html+="                <div class='box-1 '>";
                       html+="     购买时长："+orderJson.orderList[i].serviceTime+"分钟";
        html+="                </div>";
        html+="            </div>";
        html+="            <div class='box font-color-17'>";
        html+="                <div class='width-35px'>";
        html+="                    <div class='icon_70_2'></div>";
        html+="                </div>";
        html+="                <div class='box-1  '>";
        html+="      总价：&yen;"+orderJson.orderList[i].orderPrice;
        html+="                </div>";
        html+="            </div>";
        html+="        </div>";
        html+="    </div>";
        html+="    <div class='am-padding-left-sm am-padding-right-sm font-14'>";
        html+="            <div class='am-g am-text-center font-color-16 am-padding-top-xs am-padding-bottom-xs border-tops'>";
        if(orderJson.orderList[i].orderStatus=="4"){
        	html+="                <div class='am-u-sm-12  '>拒绝接单，等待用户评价</div>";
        }else{
        	html+="                <div class='am-u-sm-12  '>已结算，等待用户评价</div>";
        }
        html+="            </div>";
        html+="        </div>";
        html+="</div>";
        $(".order_list").append(html);  
        	}
        }
        }
            
    $("#btntext").on("click",function(){

        var $voices=$("#btnvoice").find(".icon_46");
        $("#font_voice").text("语言");
        $voices.removeClass("cur");

        $("#txt_question_content").removeClass("am-hide").focus();

    });

    $(".order_item .voice").on("click",function(){
          var audio = document.getElementById("audio");
          audio.src=$(this).find("input").val(); 
          var $voices= $(this).find(".icon_711");
            $(".report_item .voice").find(".icon_711").remove("cur");
            if($voices.hasClass("cur")){
                $voices.removeClass("cur");
                audio.pause();
            }else{
                $voices.addClass("cur");
                audio.play();
            }
        });
     });
	 $("#daiwangcheng").on("click", function () {
	 
        var counselorList=$.ajax({url:"${ctx}/getMyCounselorOrder?orderStatus=weiwangcheng",async:false});
        var orderJson=JSON.parse(counselorList.responseText);
        
        if(orderJson.resultCode=="0"){
        	$(".order_list").html("");
        	for(var i=0;i<orderJson.orderList.length;i++){
        	if(orderJson.orderList[i].orderType=="1"){
        	var html="";
        	var userList=$.ajax({url:"${ctx}/getUserData?userId="+orderJson.orderList[i].userId,async:false});
       	    var userJson=JSON.parse(userList.responseText);
        	
        	html+="<div class='order_item bg-white border-bottom am-margin-bottom-sm am-padding-top-sm'>";
            html+="<div onclick='window.location.href=\"${ctx}/gotoOrderDesc?orderId="+orderJson.orderList[i].id+"\"'>";
            html+="    <div class=' bg-gray am-margin-left-sm am-margin-right-sm '>";
            html+="        <div class='am-g   am-padding-top-sm am-padding-bottom-xs border-1'>";
            html+="            <div class='am-u-sm-3 am-list-thumb am-padding-left-sm'>";
            html+="                <a class=''>";
            html+="                    <img class='img-65' src='"+userJson.wxUser.headimgurl+"'/>";
            html+="                </a>";
            html+="                <i class='icon_12'></i>";
            html+="            </div>";
            html+="            <div class=' am-u-sm-9 am-list-main'>";
            html+="                <div class='am-list-item-hd font-color-main'>";
                                html+=""+userJson.wxUser.nickname;
            html+="                </div>";
            html+="                <div class='font-12  font-color-11'>";
            html+="                    "+userJson.wxUser.telephone;
            html+="                </div>";
            html+="            </div>";
            html+="        </div>";
            html+="    </div>";
            html+="    <div class='am-padding-left-lg am-padding-right-sm am-padding-bottom-sm'>";
            html+="        <div class='box font-color-13 am-margin-bottom-sm am-margin-top-sm'>";
            html+="            <div class='width-35px'>";
            html+="                <div class='icon_04_1'></div>";
            html+="            </div>";
            html+="            <div class='box-1 '>";
            if(orderJson.orderList[i].counseType=="1"){
            	html+="咨询方式：电话咨询";
            }else if(orderJson.orderList[i].counseType=="2"){
            	html+="咨询方式：面对面咨询";
            }else{
            	html+="咨询方式：视频咨询";
            }
            html+="           </div>";
            html+="        </div>";
            html+="        <div class='box font-color-13 am-margin-bottom-sm'>";
            html+="            <div class='width-35px'>";
            html+="                <div class='icon_68_2'></div>";
            html+="            </div>";
            html+="            <div class='box-1 '>";
                            html+="预约时间："+orderJson.orderList[i].bookTimeStr;
            html+="            </div>";
            html+="        </div>";
            html+="        <div class='box font-color-13 am-margin-bottom-sm'>";
        html+="                <div class='width-35px'>";
        html+="                    <div class='icon_03_1'></div>";
        html+="                </div>";
        html+="                <div class='box-1 '>";
                       html+="     购买时长："+orderJson.orderList[i].serviceTime+"分钟";
        html+="                </div>";
        html+="            </div>";
        html+="            <div class='box font-color-17'>";
        html+="                <div class='width-35px'>";
        html+="                    <div class='icon_70_2'></div>";
        html+="                </div>";
        html+="                <div class='box-1  '>";
        html+="      总价：&yen;"+orderJson.orderList[i].orderPrice;
        html+="                </div>";
        html+="            </div>";
        html+="        </div>";
        html+="    </div>";
        html+="    <div class='am-padding-left-sm am-padding-right-sm font-14'>";
        html+="        <div class='am-g am-text-center font-color-16 am-padding-top-xs am-padding-bottom-xs border-tops'>";
        html+="            <div class='am-u-sm-4 border-right jujue' onclick=\"gojujue();\" data-id='"+orderJson.orderList[i].id+"'><span class='prelative padding-left-15'><i";
		html+="                    class='icon_026_1'></i>拒绝接单</span></div>";
        html+="            <div class='am-u-sm-4 border-right'><span class='prelative padding-left-15'><i";
        html+="                    class='icon_027_1'></i><a href=\"tel:"+userJson.wxUser.telephone+"\" style=\"color:#9A9AAB\">电联</a></span></div>";
        html+="            <div class='am-u-sm-4 jiesuan' data-id='"+orderJson.orderList[i].id+"'><span class='prelative padding-left-15'><i";
        html+="                    class='icon_028_2'></i>结算</span></div>";
        html+="        </div>";
        html+="    </div>";
        html+="</div>";
        $(".order_list").append(html);  
        	}
        }
        }
        $('.order_list').find('.jujue').on('click', function () {

           $('#my-prompt').modal({
               relatedTarget: this,
               onConfirm: function (options) {
                   var $link = $(this.relatedTarget);
                    var orderId=$link.data('id');
                    var mark=$("#jueContent").val();
					var orderStr=$.ajax({url:"${ctx}/updatePeixunOrder?mark="+mark+"&openType=0&orderId="+orderId,async:false});
		       	    var orderJson=JSON.parse(orderStr.responseText);
		       	    if(orderJson.resultCode=="0"){
		       	    	location.reload(true);   
		       	    }else{
		       	    	myAlert(orderJson.resultDesc);
		       	    }
               },
               onCancel: function () {

               }
           });
         });
         $('.order_list').find('.jiesuan').on('click', function () {

            $('#my-jiesuan').modal({
                relatedTarget: this,
                onConfirm: function (options) {
                    var $link = $(this.relatedTarget);
                    var orderId=$link.data('id');
                    var mark=$("#jiesuanContent").val();
					var orderStr=$.ajax({url:"${ctx}/updatePeixunOrder?mark="+mark+"&openType=1&orderId="+orderId,async:false});
		       	    var orderJson=JSON.parse(orderStr.responseText);
		       	    if(orderJson.resultCode=="0"){
		       	    	location.reload(true);   
		       	    }else{
		       	    	myAlert(orderJson.resultDesc);
		       	    }
                },
                onCancel: function () {

                }
            });
        });
            
    $("#btntext").on("click",function(){

        var $voices=$("#btnvoice").find(".icon_46");
        $("#font_voice").text("语言");
        $voices.removeClass("cur");

        $("#txt_question_content").removeClass("am-hide").focus();

    });

    $(".order_item .voice").on("click",function(){
          var audio = document.getElementById("audio");
          audio.src=$(this).find("input").val(); 
          var $voices= $(this).find(".icon_711");
            $(".report_item .voice").find(".icon_711").remove("cur");
            if($voices.hasClass("cur")){
                $voices.removeClass("cur");
                audio.pause();
            }else{
                $voices.addClass("cur");
                audio.play();
            }
        });
     });
	 $("#yiwangcheng").on("click", function () {
         var counselorList=$.ajax({url:"${ctx}/getMyCounselorOrder?orderStatus=yiwangcheng",async:false});
        var orderJson=JSON.parse(counselorList.responseText);
        
        if(orderJson.resultCode=="0"){
        	$(".order_list").html("");  
        	for(var i=0;i<orderJson.orderList.length;i++){
        	if(orderJson.orderList[i].orderType=="1"){
        	var html="";
        	var userList=$.ajax({url:"${ctx}/getUserData?userId="+orderJson.orderList[i].userId,async:false});
       	    var userJson=JSON.parse(userList.responseText);
        	
        	html+="<div class='order_item bg-white border-bottom am-margin-bottom-sm am-padding-top-sm'>";
            html+="<div onclick='window.location.href=\"${ctx}/gotoOrderDesc?orderId="+orderJson.orderList[i].id+"\"'>";
            html+="    <div class=' bg-gray am-margin-left-sm am-margin-right-sm '>";
            html+="        <div class='am-g   am-padding-top-sm am-padding-bottom-xs border-1'>";
            html+="            <div class='am-u-sm-3 am-list-thumb am-padding-left-sm'>";
            html+="                <a class=''>";
            html+="                    <img class='img-65' src='"+userJson.wxUser.headimgurl+"'/>";
            html+="                </a>";
            html+="                <i class='icon_12'></i>";
            html+="            </div>";
            html+="            <div class=' am-u-sm-9 am-list-main'>";
            html+="                <div class='am-list-item-hd font-color-main'>";
                                html+=""+userJson.wxUser.nickname;
            html+="                </div>";
            html+="                <div class='font-12  font-color-11'>";
            html+="                    "+userJson.wxUser.telephone;
            html+="                </div>";
            html+="            </div>";
            html+="        </div>";
            html+="    </div>";
            html+="    <div class='am-padding-left-lg am-padding-right-sm am-padding-bottom-sm'>";
            html+="        <div class='box font-color-13 am-margin-bottom-sm am-margin-top-sm'>";
            html+="            <div class='width-35px'>";
            html+="                <div class='icon_04_1'></div>";
            html+="            </div>";
            html+="            <div class='box-1 '>";
            if(orderJson.orderList[i].counseType=="1"){
            	html+="咨询方式：电话咨询";
            }else if(orderJson.orderList[i].counseType=="2"){
            	html+="咨询方式：面对面咨询";
            }else{
            	html+="咨询方式：视频咨询";
            }
            html+="           </div>";
            html+="        </div>";
            html+="        <div class='box font-color-13 am-margin-bottom-sm'>";
            html+="            <div class='width-35px'>";
            html+="                <div class='icon_68_2'></div>";
            html+="            </div>";
            html+="            <div class='box-1 '>";
                            html+="预约时间："+orderJson.orderList[i].bookTimeStr;
            html+="            </div>";
            html+="        </div>";
            html+="        <div class='box font-color-13 am-margin-bottom-sm'>";
        html+="                <div class='width-35px'>";
        html+="                    <div class='icon_03_1'></div>";
        html+="                </div>";
        html+="                <div class='box-1 '>";
                       html+="     购买时长："+orderJson.orderList[i].serviceTime+"分钟";
        html+="                </div>";
        html+="            </div>";
        html+="            <div class='box font-color-17'>";
        html+="                <div class='width-35px'>";
        html+="                    <div class='icon_70_2'></div>";
        html+="                </div>";
        html+="                <div class='box-1  '>";
        html+="      总价：&yen;"+orderJson.orderList[i].orderPrice;
        html+="                </div>";
        html+="            </div>";
        html+="        </div>";
        html+="    </div>";
        html+="</div>";
        $(".order_list").append(html);  
        	}
        }
        }
            
    $("#btntext").on("click",function(){

        var $voices=$("#btnvoice").find(".icon_46");
        $("#font_voice").text("语言");
        $voices.removeClass("cur");

        $("#txt_question_content").removeClass("am-hide").focus();

    });

    $(".order_item .voice").on("click",function(){
          var audio = document.getElementById("audio");
          audio.src=$(this).find("input").val(); 
          var $voices= $(this).find(".icon_711");
            $(".report_item .voice").find(".icon_711").remove("cur");
            if($voices.hasClass("cur")){
                $voices.removeClass("cur");
                audio.pause();
            }else{
                $voices.addClass("cur");
                audio.play();
            }
        });
     });

 	 $("#quanbu").on("click", function () {
         var counselorList=$.ajax({url:"${ctx}/getMyCounselorOrder",async:false});
        var orderJson=JSON.parse(counselorList.responseText);
        
        if(orderJson.resultCode=="0"){
        	$(".order_list").html("");
        	for(var i=0;i<orderJson.orderList.length;i++){
        	var html="";
        	var userList=$.ajax({url:"${ctx}/getUserData?userId="+orderJson.orderList[i].userId,async:false});
       	    var userJson=JSON.parse(userList.responseText);
        	
        	html+="<div class='order_item bg-white border-bottom am-margin-bottom-sm am-padding-top-sm'>";
            html+="<div onclick='window.location.href=\"${ctx}/gotoOrderDesc?orderId="+orderJson.orderList[i].id+"\"'>";
            html+="    <div class=' bg-gray am-margin-left-sm am-margin-right-sm '>";
            html+="        <div class='am-g   am-padding-top-sm am-padding-bottom-xs border-1'>";
            html+="            <div class='am-u-sm-3 am-list-thumb am-padding-left-sm'>";
            html+="                <a class=''>";
            html+="                    <img class='img-65' src='"+userJson.wxUser.headimgurl+"'/>";
            html+="                </a>";
            html+="                <i class='icon_12'></i>";
            html+="            </div>";
            html+="            <div class=' am-u-sm-9 am-list-main'>";
            html+="                <div class='am-list-item-hd font-color-main'>";
                                html+=""+userJson.wxUser.nickname;
            html+="                </div>";
            html+="                <div class='font-12  font-color-11'>";
            html+="                    "+userJson.wxUser.telephone;
            html+="                </div>";
            html+="            </div>";
            html+="        </div>";
            html+="    </div>";
            html+="    <div class='am-padding-left-lg am-padding-right-sm am-padding-bottom-sm'>";
            html+="        <div class='box font-color-13 am-margin-bottom-sm am-margin-top-sm'>";
            html+="            <div class='width-35px'>";
            html+="                <div class='icon_04_1'></div>";
            html+="            </div>";
            html+="            <div class='box-1 '>";
            if(orderJson.orderList[i].counseType=="1"){
            	html+="咨询方式：电话咨询";
            }else if(orderJson.orderList[i].counseType=="2"){
            	html+="咨询方式：面对面咨询";
            }else{
            	html+="咨询方式：视频咨询";
            }
            html+="           </div>";
            html+="        </div>";
            html+="        <div class='box font-color-13 am-margin-bottom-sm'>";
            html+="            <div class='width-35px'>";
            html+="                <div class='icon_68_2'></div>";
            html+="            </div>";
            html+="            <div class='box-1 '>";
                            html+="预约时间："+orderJson.orderList[i].bookTimeStr;
            html+="            </div>";
            html+="        </div>";
            html+="        <div class='box font-color-13 am-margin-bottom-sm'>";
        html+="                <div class='width-35px'>";
        html+="                    <div class='icon_03_1'></div>";
        html+="                </div>";
        html+="                <div class='box-1 '>";
                       html+="     购买时长："+orderJson.orderList[i].serviceTime+"分钟";
        html+="                </div>";
        html+="            </div>";
        html+="            <div class='box font-color-17'>";
        html+="                <div class='width-35px'>";
        html+="                    <div class='icon_70_2'></div>";
        html+="                </div>";
        html+="                <div class='box-1  '>";
        html+="      总价：&yen;"+orderJson.orderList[i].orderPrice;
        html+="                </div>";
        html+="            </div>";
        html+="        </div>";
        html+="    </div>";
        html+="    <div class='am-padding-left-sm am-padding-right-sm font-14'>";
        html+="        <div class='am-g am-text-center font-color-16 am-padding-top-xs am-padding-bottom-xs border-tops'>";
        if(orderJson.orderList[i].orderStatus=="4"){
		        	html+="                <div class='am-u-sm-12  '>拒绝接单，等待用户评价</div>";
        }else if(orderJson.orderList[i].orderStatus=="6" || orderJson.orderList[i].orderStatus=="0" || orderJson.orderList[i].orderStatus=="1"){
        	html+="            <div class='am-u-sm-4 border-right jujue' data-id='"+orderJson.orderList[i].id+"'><span class='prelative padding-left-15'><i";
	        html+="                    class='icon_026_1'></i>拒绝接单</span></div>";
	        html+="            <div class='am-u-sm-4 border-right'><span class='prelative padding-left-15'><i";
	        html+="                    class='icon_027_1'></i><a href=\"tel:"+userJson.wxUser.telephone+"\" style=\"color:#9A9AAB\">电联</a></span></div>";
	        html+="            <div class='am-u-sm-4 jiesuan' data-id='"+orderJson.orderList[i].id+"'><span class='prelative padding-left-15'><i";
	        html+="                    class='icon_028_2'></i>结算</span></div>";
        }else if(orderJson.orderList[i].orderStatus=="2"){
        	html+="                <div class='am-u-sm-12  '>已结算，等待用户评价</div>";
        }
        html+="        </div>";
        html+="    </div>";
        html+="</div>";
        $(".order_list").append(html);
        	}
        }
        $('.order_list').find('.jujue').on('click', function () {

           $('#my-prompt').modal({
               relatedTarget: this,
               onConfirm: function (options) {
                   var $link = $(this.relatedTarget);
                    var orderId=$link.data('id');
                    var mark=$("#jueContent").val();
					var orderStr=$.ajax({url:"${ctx}/updatePeixunOrder?mark="+mark+"&openType=0&orderId="+orderId,async:false});
		       	    var orderJson=JSON.parse(orderStr.responseText);
		       	    if(orderJson.resultCode=="0"){
		       	    	location.reload(true);   
		       	    }else{
		       	    	myAlert(orderJson.resultDesc);
		       	    }
               },
               onCancel: function () {

               }
           });
         });
         
         $('.order_list').find('.jiesuan').on('click', function () {

            $('#my-jiesuan').modal({
                relatedTarget: this,
                onConfirm: function (options) {
                    var $link = $(this.relatedTarget);
                    var orderId=$link.data('id');
                    var mark=$("#jiesuanContent").val();
					var orderStr=$.ajax({url:"${ctx}/updatePeixunOrder?mark="+mark+"&openType=1&orderId="+orderId,async:false});
		       	    var orderJson=JSON.parse(orderStr.responseText);
		       	    if(orderJson.resultCode=="0"){
		       	    	location.reload(true);   
		       	    }else{
		       	    	myAlert(orderJson.resultDesc);
		       	    }
                },
                onCancel: function () {

                }
            });
        });
            
    $("#btntext").on("click",function(){

        var $voices=$("#btnvoice").find(".icon_46");
        $("#font_voice").text("语言");
        $voices.removeClass("cur");

        $("#txt_question_content").removeClass("am-hide").focus();

    });

    $(".order_item .voice").on("click",function(){
          var audio = document.getElementById("audio");
          audio.src=$(this).find("input").val(); 
          var $voices= $(this).find(".icon_711");
            $(".report_item .voice").find(".icon_711").remove("cur");
            if($voices.hasClass("cur")){
                $voices.removeClass("cur");
                audio.pause();
            }else{
                $voices.addClass("cur");
                audio.play();
            }
        });
     });
	

    $(function () {
    	
    	var counselorList=$.ajax({url:"${ctx}/getMyCounselorOrder",async:false});
        var orderJson=JSON.parse(counselorList.responseText);
        
        if(orderJson.resultCode=="0"){
	        	$(".order_list").html("");
	        	for(var i=0;i<orderJson.orderList.length;i++){
		        	var html="";
		        	var userList=$.ajax({url:"${ctx}/getUserData?userId="+orderJson.orderList[i].userId,async:false});
		       	    var userJson=JSON.parse(userList.responseText);
		        	html+="<div class='order_item bg-white border-bottom am-margin-bottom-sm am-padding-top-sm'>";
		            html+="<div onclick='window.location.href=\"${ctx}/gotoOrderDesc?orderId="+orderJson.orderList[i].id+"\"'>";
		            html+="    <div class=' bg-gray am-margin-left-sm am-margin-right-sm '>";
		            html+="        <div class='am-g   am-padding-top-sm am-padding-bottom-xs border-1'>";
		            html+="            <div class='am-u-sm-3 am-list-thumb am-padding-left-sm'>";
		            html+="                <a class=''>";
		            html+="                    <img class='img-65' src='"+userJson.wxUser.headimgurl+"'/>";
		            html+="                </a>";
		            html+="                <i class='icon_12'></i>";
		            html+="            </div>";
		            html+="            <div class=' am-u-sm-9 am-list-main'>";
		            html+="                <div class='am-list-item-hd font-color-main'>";
		                                html+=""+userJson.wxUser.nickname;
		            html+="                </div>";
		            html+="                <div class='font-12  font-color-11'>";
		            html+="                    "+userJson.wxUser.telephone;
		            html+="                </div>";
		            html+="            </div>";
		            html+="        </div>";
		            html+="    </div>";
		            html+="    <div class='am-padding-left-lg am-padding-right-sm am-padding-bottom-sm'>";
		            html+="        <div class='box font-color-13 am-margin-bottom-sm am-margin-top-sm'>";
		            html+="            <div class='width-35px'>";
		            html+="                <div class='icon_04_1'></div>";
		            html+="            </div>";
		            html+="            <div class='box-1 '>";
		            if(orderJson.orderList[i].counseType=="1"){
		            	html+="咨询方式：电话咨询";
		            }else if(orderJson.orderList[i].counseType=="2"){
		            	html+="咨询方式：面对面咨询";
		            }else{
		            	html+="咨询方式：视频咨询";
		            }
		            html+="           </div>";
		            html+="        </div>";
		            html+="        <div class='box font-color-13 am-margin-bottom-sm'>";
		            html+="            <div class='width-35px'>";
		            html+="                <div class='icon_68_2'></div>";
		            html+="            </div>";
		            html+="            <div class='box-1 '>";
		                            html+="预约时间："+orderJson.orderList[i].bookTimeStr;
		            html+="            </div>";
		            html+="        </div>";
		            html+="        <div class='box font-color-13 am-margin-bottom-sm'>";
		        html+="                <div class='width-35px'>";
		        html+="                    <div class='icon_03_1'></div>";
		        html+="                </div>";
		        html+="                <div class='box-1 '>";
		                       html+="     购买时长："+orderJson.orderList[i].serviceTime+"分钟";
		        html+="                </div>";
		        html+="            </div>";
		        html+="            <div class='box font-color-17'>";
		        html+="                <div class='width-35px'>";
		        html+="                    <div class='icon_70_2'></div>";
		        html+="                </div>";
		        html+="                <div class='box-1  '>";
		        html+="      总价：&yen;"+orderJson.orderList[i].orderPrice;
		        html+="                </div>";
		        html+="            </div>";
		        html+="        </div>";
		        html+="    </div>";
		        html+="    <div class='am-padding-left-sm am-padding-right-sm font-14'>";
		        html+="        <div class='am-g am-text-center font-color-16 am-padding-top-xs am-padding-bottom-xs border-tops'>";
		        if(orderJson.orderList[i].orderStatus=="4"){
		        	html+="                <div class='am-u-sm-12  '>拒绝接单，等待用户评价</div>";
		        }else if(orderJson.orderList[i].orderStatus=="6" || orderJson.orderList[i].orderStatus=="0" || orderJson.orderList[i].orderStatus=="1"){
		        	html+="            <div class='am-u-sm-4 border-right jujue' data-id='"+orderJson.orderList[i].id+"'><span class='prelative padding-left-15'><i";
			        html+="                    class='icon_026_1'></i>拒绝接单</span></div>";
			        html+="            <div class='am-u-sm-4 border-right'><span class='prelative padding-left-15'><i";
			        html+="                    class='icon_027_1'></i><a href=\"tel:"+userJson.wxUser.telephone+"\" style=\"color:#9A9AAB\">电联</a></span></div>";
			        html+="            <div class='am-u-sm-4 jiesuan' data-id='"+orderJson.orderList[i].id+"'><span class='prelative padding-left-15'><i";
			        html+="                    class='icon_028_2'></i>结算</span></div>";
		        }else if(orderJson.orderList[i].orderStatus=="2"){
		        	html+="                <div class='am-u-sm-12  '>已结算，等待用户评价</div>";
		        }
		        html+="        </div>";
		        html+="    </div>";
		        html+="</div>";
		        $(".order_list").append(html);
        	}
          }
    
        $('.order_list').find('.jujue').on('click', function () {

            $('#my-prompt').modal({
                relatedTarget: this,
                onConfirm: function (options) {
                    var $link = $(this.relatedTarget);
                    var orderId=$link.data('id');
                    var mark=$("#jueContent").val();
					var orderStr=$.ajax({url:"${ctx}/updatePeixunOrder?mark="+mark+"&openType=0&orderId="+orderId,async:false});
		       	    var orderJson=JSON.parse(orderStr.responseText);
		       	    if(orderJson.resultCode=="0"){
		       	    	location.reload(true);   
		       	    }else{
		       	    	myAlert(orderJson.resultDesc);
		       	    }
                },
                onCancel: function () {

                }
            });
        });

        $('.order_list').find('.jiesuan').on('click', function () {

            $('#my-jiesuan').modal({
                relatedTarget: this,
                onConfirm: function (options) {
                    var $link = $(this.relatedTarget);
                    var orderId=$link.data('id');
                    var mark=$("#jiesuanContent").val();
					var orderStr=$.ajax({url:"${ctx}/updatePeixunOrder?mark="+mark+"&openType=1&orderId="+orderId,async:false});
		       	    var orderJson=JSON.parse(orderStr.responseText);
		       	    if(orderJson.resultCode=="0"){
		       	    	location.reload(true);   
		       	    }else{
		       	    	myAlert(orderJson.resultDesc);
		       	    }
                },
                onCancel: function () {

                }
            });
        });
            
    $("#btntext").on("click",function(){

        var $voices=$("#btnvoice").find(".icon_46");
        $("#font_voice").text("语言");
        $voices.removeClass("cur");

        $("#txt_question_content").removeClass("am-hide").focus();

    });

    $(".order_item .voice").on("click",function(){
          var audio = document.getElementById("audio");
          audio.src=$(this).find("input").val(); 
          var $voices= $(this).find(".icon_711");
            $(".report_item .voice").find(".icon_711").remove("cur");
            if($voices.hasClass("cur")){
                $voices.removeClass("cur");
                audio.pause();
            }else{
                $voices.addClass("cur");
                audio.play();
            }
        });
    });
    
    $("#btntext").on("click",function(){

        var $voices=$("#btnvoice").find(".icon_46");
        $("#font_voice").text("语言");
        $voices.removeClass("cur");

        $("#txt_question_content").removeClass("am-hide").focus();

    });

    $(".order_item .voice").on("click",function(){
          var audio = document.getElementById("audio");
          audio.src=$(this).find("input").val(); 
          var $voices= $(this).find(".icon_711");
            $(".report_item .voice").find(".icon_711").remove("cur");
            if($voices.hasClass("cur")){
                $voices.removeClass("cur");
                audio.pause();
            }else{
                $voices.addClass("cur");
                audio.play();
            }
        });
</script>

</body>
</html>